package ubiqweb.spring3.dao;

import java.util.List;
import ubiqweb.spring3.model.LoginDetails;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class LoginDaoImpl implements LoginDao{

	@Autowired
	private SessionFactory sessionFactory;
	
	@SuppressWarnings("unchecked")
	public List<LoginDetails> getListLoginDetails(String userName, String password){
		return sessionFactory.getCurrentSession().createQuery("from LoginDetails where userName = '" +userName +
																"'and password = '" + password +"'").list();
		
	}
	
	@SuppressWarnings("unchecked")
	public List<LoginDetails> getListLoginDetails(String userId){
		return sessionFactory.getCurrentSession().createQuery("from LoginDetails where userId = '" +userId + "'").list();
		
	}
}
